import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useDeviceStore = defineStore(
  'device',
  () => {
    // 设备id
    const deviceSpotTaskId = ref(null)
    // 异常提报类型
    const problemType = ref(null)
    // 异常提报数据id
    const deviceAnomalyReportId = ref(null)
    const setDeviceSpotTaskId = (newVal) => {
      deviceSpotTaskId.value = newVal
    }
    const setProblemType = (newVal) => {
      problemType.value = newVal
    }
    const setDeviceAnomalyReportId = (newVal) => {
      deviceAnomalyReportId.value = newVal
    }
    return {
      deviceSpotTaskId,
      setDeviceSpotTaskId,
      problemType,
      setProblemType,
      deviceAnomalyReportId,
      setDeviceAnomalyReportId,
    }
  },
  {
    persist: true,
  },
)
